package com.ruoyi.cngj.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cngj.mapper.CngjPostMapper;
import com.ruoyi.cngj.domain.CngjPost;
import com.ruoyi.cngj.service.ICngjPostService;
import com.ruoyi.common.core.text.Convert;

/**
 * 招聘岗位Service业务层处理
 * 
 * @author yuexl
 * @date 2024-06-27
 */
@Service
public class CngjPostServiceImpl implements ICngjPostService 
{
    @Autowired
    private CngjPostMapper cngjPostMapper;

    /**
     * 查询招聘岗位
     * 
     * @param id 招聘岗位ID
     * @return 招聘岗位
     */
    @Override
    public CngjPost selectCngjPostById(String id)
    {
        return cngjPostMapper.selectCngjPostById(id);
    }

    /**
     * 查询招聘岗位列表
     * 
     * @param cngjPost 招聘岗位
     * @return 招聘岗位
     */
    @Override
    public List<CngjPost> selectCngjPostList(CngjPost cngjPost)
    {
        return cngjPostMapper.selectCngjPostList(cngjPost);
    }

    /**
     * 新增招聘岗位
     * 
     * @param cngjPost 招聘岗位
     * @return 结果
     */
    @Override
    public int insertCngjPost(CngjPost cngjPost)
    {
        cngjPost.setId(IdWorker.getId());
        cngjPost.setCreateTime(DateUtils.getNowDate());
        return cngjPostMapper.insertCngjPost(cngjPost);
    }

    /**
     * 修改招聘岗位
     * 
     * @param cngjPost 招聘岗位
     * @return 结果
     */
    @Override
    public int updateCngjPost(CngjPost cngjPost)
    {
        cngjPost.setUpdateTime(DateUtils.getNowDate());
        return cngjPostMapper.updateCngjPost(cngjPost);
    }

    /**
     * 删除招聘岗位对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCngjPostByIds(String ids)
    {
        return cngjPostMapper.deleteCngjPostByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除招聘岗位信息
     * 
     * @param id 招聘岗位ID
     * @return 结果
     */
    @Override
    public int deleteCngjPostById(String id)
    {
        return cngjPostMapper.deleteCngjPostById(id);
    }
}
